﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BT_Mang_Nhom13.Checker;
using BT_Mang_Nhom13.Sorter;

namespace BT_Mang_Nhom13.Library
{
    public class MyArray<T> where T: IComparable<T>
    {
        T[] Data;

        public MyArray(T[] newData)
        {
            Data = newData;
        }

        public T this [int index]
        {
            get 
            {
                return Data[index];
            }
           
        }

        public void Sort(MySorter<T> Sorter, MyComparer<T> Comparer)
        {
            Data = Sorter.Sort(Data, Comparer);
        }

        public void Sort(MySorter<T> Sorter, Func<T, T, int> Compare)
        {
            Data = Sorter.Sort(Data, Compare);
        }

        public void Print()
        {
            for (int i = 0; i < Data.Length; i++)
            {
                Console.Write(Data[i] + " " + "\n");
            }

            Console.WriteLine();
        }
    }
}
